for ($i=100;$i<=999;$i++) {
    for ($j=100;$j<=999;$j++) {
        $k=$i*$j;
        $left=0;
        $right=-1+length $k;
        while (substr($k,$left,1) eq substr($k,$right,1) & $left<$right) {
            $left++; $right--;
        }
        if ($left >= $right & $k>$max) { # It's a palindrome!
            $max=$k;
        }
    }
}

print "$max\n";